package cn.edu.gsau.info.dao;

import cn.edu.gsau.info.models.Rongyuchenghao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jinjiang
 * @since 2022-11-17
 */
public interface RongyuchenghaoDao extends BaseMapper<Rongyuchenghao> {
    //通过填报人id查询
    @Select("SELECT * \n" +
            "FROM tbl_rongyuchenghao\n" +
            "WHERE tbl_rongyuchenghao.tianbaoId=#{id} and tbl_rongyuchenghao.deleted=0")
    IPage selectById(long id);
    //通过荣誉称号id查询
    @Select("SELECT * \n" +
            "FROM tbl_rongyuchenghao\n" +
            "WHERE tbl_rongyuchenghao.id=#{id} and tbl_rongyuchenghao.deleted=0")
    Rongyuchenghao selectByRongyuchenghaoId(int id);
    //通过关键字查询
    @Select("SELECT * \n" +
            "FROM tbl_rongyuchenghao\n" +
            "WHERE tbl_rongyuchenghao.rongyuChengHao LIKE #{string} and tbl_rongyuchenghao.deleted=0")
    List<Rongyuchenghao> selectByStr(String string);
    //通过状态查询
    @Select("SELECT * \n" +
            "FROM tbl_rongyuchenghao\n" +
            "WHERE tbl_rongyuchenghao.status=#{status} and tbl_rongyuchenghao.deleted=0")
    List<Rongyuchenghao> selectByStatus(String status);
    //通过关键字和状态查询
    @Select("SELECT * \n" +
            "FROM tbl_rongyuchenghao\n" +
            "WHERE  tbl_rongyuchenghao.status=#{status} \n" +
            "AND tbl_rongyuchenghao.rongyuchenghao LIKE #{string} and tbl_rongyuchenghao.deleted=0")
    List<Rongyuchenghao> selectLike(String string,String status);
}
